package org.example.completed.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.completed.domain.Pet;
import java.util.List;

@Mapper
public interface PetMapper {

    // 获取所有宠物
    @Select("SELECT petsId, name, image_url FROM pets")
    List<Pet> getAllPets();

    // 根据名称查询宠物
    @Select("SELECT petsId, name, image_url FROM pets WHERE name = #{name}")
    List<Pet> getPetsByName(String name);

    // 根据图片URL查询宠物
    @Select("SELECT petsId, name, image_url FROM pets WHERE image_url = #{imageUrl}")
    List<Pet> getPetsByImageUrl(String imageUrl);
}
